package com.wao.product.service.dto;


import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.LinkedHashSet;
import java.util.Objects;

/**
 * A DTO for the Product entity.
 */
public class ProductAttributeDTO implements Serializable {

    private Long id;

    @NotNull
    private String name;

    private String image;

    @NotNull
    private Boolean enabled;

    private Integer displayOrder;

    @Size(max = 8)
    private String langKey;

    @NotNull
    private Long categoryId;

    private Long brandId;

    private String brandName;

    private LinkedHashSet<PictureDTO> pictures = new LinkedHashSet<>();

    private LinkedHashSet<AttributeDTO> attributes = new LinkedHashSet<>();

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public Boolean getEnabled() {
        return enabled;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

    public Integer getDisplayOrder() {
        return displayOrder;
    }

    public void setDisplayOrder(Integer displayOrder) {
        this.displayOrder = displayOrder;
    }

    public String getLangKey() {
        return langKey;
    }

    public void setLangKey(String langKey) {
        this.langKey = langKey;
    }

    public Long getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }

    public Long getBrandId() {
        return brandId;
    }

    public void setBrandId(Long brandId) {
        this.brandId = brandId;
    }

    public String getBrandName() {
        return brandName;
    }

    public void setBrandName(String brandName) {
        this.brandName = brandName;
    }

    public LinkedHashSet<PictureDTO> getPictures() {
        return pictures;
    }

    public void setPictures(LinkedHashSet<PictureDTO> pictures) {
        this.pictures = pictures;
    }

    public LinkedHashSet<AttributeDTO> getAttributes() {
        return attributes;
    }

    public void setAttributes(LinkedHashSet<AttributeDTO> attributes) {
        this.attributes = attributes;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        ProductAttributeDTO productDTO = (ProductAttributeDTO) o;
        if (productDTO.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), productDTO.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "ProductAttributeDTO{" +
            "id=" + id +
            ", name='" + name + '\'' +
            ", categoryId=" + categoryId +
            ", brandId=" + brandId +
            ", brandName='" + brandName + '\'' +
            '}';
    }
}
